Fixed some bugs and issues