add callback only when needed