weird compiler problem let temporary variables undefined in some intermediate results