fixed out-of-bound access during logging