Fix for npe for factory beans