fixed bug #8 & #9