Fixed issues #421, #419
Fixed issue #420