Should fix the inversion properly now. Forgot to add a ! operator to one of the button checks for fences button.