fix allocation calculation