Fix some of #169
Fix #167