fixed moving card function