fix some problems with assertions

they should throw errors when they fail, which wasn't always the case :(