Fix #39, fix #40