Fix issue #34 and issue #33