Bugfix for case statement on res