updating to new api, bug fixes