Bug fixes and logging code.