Fix some bugs. Done