Fixed possible UB