Fixing no rows error