added null handling in chprintf to simplify debugging