Added some failure checks