Fix error when showing preferences window