fix bugs - issue #31