register returns 0 on success