Added error checking for inventory purchases