Why is this set as false here, then later overwritten with a function and in the function set as true again? Am I missing something here?