fixed bug #3; discovered others