segfault fix

Hi

Fixed the mentioned two assertions and another that might also been wrong.