Added some bugfixes.