Fixed saving refactoring bug, auto-detect file syntax.