BUG: Fixed a few bugs