Fixed bug #48 and #47
Fixed bug #48 and #47