some nullchecks and asserts maybe?