Remove unused imports
Fix resource deregistration queries