needs testing, fix #1623