checking if f is set before writing