minor fix for bucket retrieval function, and a helper function