Bug fixes that prevented compiling