Fixed javascript issues