Fixed issue #51 and issue #52