Fixed error checking bug - added server side script