Exception catching not working, need to fix