Fixed error while deleting any kind of object. Fixes #26