real scope for variables and resolve some pointers