try to fix #441

 pick up some modifications from gcin

seems fixed the issue #441

https://github.com/czchen/debian-gcin/commit/1bb7f2c3a683ff9043afd958c98fba5c8a3a6441