changed isLegalMove