Fixed #695 and fixed #679