fixed the where bugs