fixed small bug in python mode activation code