fixed reference error in stat, it actually works now