Fixed #543 and fixed #751