Support gcc 4.9 in cmake, fix uninitialized value warnings