bug fixes and new apis