Fixed issues #579,#649,#713,#712