fix some bugs, still strange results