fixed a bug in types
added paranoid checks in smb_deps to prevent NULL pointer dereferences and corner-case memory leaks.