Fixed bug #49 and #50