fix log and clean up