fixed cancel button on add file dialog
made var scopes more sensible