Fix some warnings due to uint16_t!=-1 always being true