Fixed problems with tmp2 being uninitialized on program start