fix issues #532, #537