finally fixed a crazy bug