fixing bugs found while running in strict mode