fixed some bugs, this thing should work now