fix bug #423, #422, #414