change casts, add tests for self-eval