fixed func0-func1 are switched mistake and refactoring