fixed scope, stat and func
add func tests