Fix an assertion error and remove unneeded stuff