Move initial code from head to body to avoid a weird bug in IE. fix #21