Fixed some more warnings and bugs.