Added some error checking for when passing bad data from the client side