fixing bug with stat