properly cast case types in helper functions and add helper + test