fixed a crucial bug