fix bugs and add auth.