var self defined in wrong scope