modify def register which returns a json string now