save/load to file and other bug fixes