fix bug #5 completely