fixed js bug for on load