added alt error handling
added error handling