Fixed #495 and fixed #469