Fixed weird bugs.