Fixed a few bugs (continued)