fixed NPE when saving positions, close #1782