fixing many of bugs