improved error checking on row() and col()
added more error checking