fixed miscalculation for small header chunks