Fixed casting bug with explicit cast (vs implicity assumption of memory layout when casting)