fixing issue 738

fixed https://github.com/kframework/k/issues/738
The bug is reported for Java backend without --pattern-matching option. I tried to test --pattern-matching as well and found a class cast exception.