Fix bug with localPath in loadObjectFromFile