Fix valid() function - returns bot valid on the last row before this change.