debugging strange bug