Some bug fixes.