fix issue #509