Fix wrong location attribute detection

This is a small bug detected recently. Very easy to fix.