var self defined in wrong scope

Found this bug testing video, not sure when it was introduced.