fix issue #506