fix #509
Fix #503