@VSEphpbb found an error with the logic