resolving some bugs