cleanup, fixed bug #40