refine code for bug #66