add some asserts, to prevent bugs