Fixed a few remaining bugs