better exception handling for import