Fixed #233 and #173