better error handling and loading bar attempt