Maybe raise an exception here, instead of having the assert?