fixing javascript for matrix fields and some error checking stuff