fixing some bugs
manual merge