some bugs fixed, still weird behavior