fix operator undefined behavior