Fix for sql rowcount error