Created temporary cast to write unsigned short to file.