Added some error cases