test and fix vars defined inside blocks