fixed api not working functionality