Fixed #595
fixed #558