Fixes for dialyzer errors

Fixing some -type declarations and pattern matching because of Dialyzer errors.