added two 'var' statements to comply with use strict