Remove unnecessary database queries during reimport.
Fix for import and reimport of singleton items.
Comply with PEP8.