Better handling of invalid locations