actually I slightly changed it, but fixed the issue. Also for case classes.