Fix #179 and #180