fixing err catch