normalizes xtag callbacks and add "beforeOptions"