fixed lots of bugs including the one where saving was inpossible. Also added the SaveCommand.