Fix 147

Fixed bug #147 and #150