updated with fix and new APIs