Fix #151 and #152