fixed problem where never submited pagegs, implemented basic error checks