fixed bug #1 #3