Cleaned up dialyzer warnings and fixed realted errors.