fixes #600 and #599