Fixed size calculation and some compile errors.