Further bug fixes