fixed logging and replay bug