Add check for undefined geometry to bars fit function