fix bug with initialization of inageNum