fix a couple bugs