added error catch