Fix #185 and #186