moved gui option into if block
fixed script