handling processEvents while under callback mode