more error checking and asserts during initialization