added #562 and #594