fixed #388, fixed #365