added condition when a activity should be started