Added some error conditions