Fixed some issues in the new api implementation