Fixed bug in saving, throw exception when wrong context