correct logic error(s), only install gem if needed