bug almost fixed