Strict mode incorrectly reset after function