fix issue #28 and #11