a couple bugs fix