fix some very embarrassing bugs