Switch log on/off; bugfix