Fixes several warnings that occur during the build

This fixes warnings due to unchecked and not exhaustive pattern
matching.