fix rainbow function