more new js api fixes and cleanup