Fixed several other bugs