Bugfix for element resolving when refactoring statements