fix bug

fix lots bugs, now it works!