Remove undefined behaviour in selective implementation

Small change to fix UB.