Common JS API: optional callbacks fixed