improve row/col offset functions