Issue290 - fix #290 and #323