fixed api bugs

still a lot to do.