Correct typecasting annotations. Tweak build tasks.