Handle no rows properly