fixes #236, #238, #239