Fix #239
Fix #231
Fix #238