fix: undefined behavior with enable func