Fixed some bugs
Merged changes