Fixed some bugs in develop branch