Fixed a few bugs. Found a few more I will fix as well.