Fixed #167 and #137