Fixed #244
Fixed #245
Improve #246