bugfix and add new api