solving some bugs