Bug fix for case codes