more error handling/switch coverage and assert() checking