Fixing some exceptions thrown