updated with malloc shift