Some more bug fixes/improvements.