fix issue causing double nested block for function definitions