add 'use strict' everywhere and fixed resulting bugs