Tried some debugging, but failed to catch exceptions