bugfix in where statements