print stacktrace in debug mode, remove unused imports