fixing some bugs and added a healthcheck