move stat to common functions