Added `val` and `assert` from `deftype` branch, and fixed `apply` returns
Remove all `const` usage