Incorrect handling of application_name

If application_name contains an & --scan-app fails with error: local variable 'res' referenced before assignment

Edited by Raul Barreras