Fixed wrong order of function.