fix log middleware