Fixed bug in _onload handling