Some things don't seem to be wrong until we look at the context. Was taking a census what caused the punishment for Israel or was it something deeper?