Move free_ok to a method to be more reliable.