put registration in onload function