Some bugfixing and old code updates.