Fix wrong location attribute detection

This is a small bug detected recently (issue #351). Very easy to fix.