callback is sometimes called twice