debug switching added