Bugfix: used wrong variable

Using wrong variable made the application to crash.