Resolved some bugs