Fixed the mistake of wrong positioning of assert statements.