Refs #3809 - Remove useless assignments

This removes a lot of variables that occupied space in memory for nothing, and I added some debug + backtrace for some exceptions.
Isn't this a common/normal condition though if the user is doing a class import with only a smart proxy ID?