A number of bug fixes due to unfinished commits