fix function scope and tabs