Fixed #768, fixed #772