Attempt to fix #261 and fix #163