some common helper functions