Space charge effects near inhomogeneous cathodes