Fixed wrong variables scope
Merge branch 'develop'

* develop:
  Fixed wrong variables scope