Add assertions in more places