Fixed #987
Fixed #995