Fixed javascript for registration