fixed issue #8, 9, 10