fix logging bug
might work better.