fixing time wrapping