Fix allocated memory sizes.