new improved logging system (also bugfix