Fixed wrong import and exception handling