fix narrowing conversion warnings
fix read return value check
display level number in hex