Fixed logic bug with row validation