Fixed #400 and fixed #492