Fixed some bugs.
Merged