Minor correction on readimage() function.