Added check for invalid row coordinate due to negative indexing