Added serverside error checking