fixed undefined property and stat calculation