Fixed where function

Just noticed that the where function had errors with actual variables,
but was ok with numbers.