fixed some bugs, but still one remains...