Fixing type and build errors