Fix transmute not accepting type parameters by moving transmute call to later closure functions
Add assertions to closures