better error handling
fixed imports