asserts in a common function - thanks @cyli