fixed bug #33 and #35