Fixed #277
Fixed #396