fix loop syntax and gem version