fix reading from NULL; sentinel lost due to conversion to char from int