fix enum casting errors