Fix (and warnings) for weird bug