added error handling for whitespace locations in setlocationfragment