fixed failing in 12.04

Fixed the "Error reading file" if fread read too many bits.