Made some more bug fixes