fixed issue #4 by Ma