Removed compile warnings about undefined behaviour