I take it that you are reading ANALYZE 7.5 formatted .hdr/.img file pairs, and that the .hdr file has dim[3]=14 indicating 14 slices? You can check this by using the AFNI program
mayo_analyze fred.hdr (for example), which will print out the header info from the file
fred.hdr. If the file is really incorrect, this is fairly annoying.
bob cox