fixing zimages ref before assignment