Fixed some weird bugs.