Fix for location encoding problem