fixing error catch issue