added error handling for application loading